Skip to content

Add input-driven HMM classes where state transitions are conditioned on inputs - #452

Open
umeshksingla wants to merge 3 commits into
probml:mainfrom
umeshksingla:inpglmhmm
Open

Add input-driven HMM classes where state transitions are conditioned on inputs#452
umeshksingla wants to merge 3 commits into
probml:mainfrom
umeshksingla:inpglmhmm

Conversation

@umeshksingla

Copy link
Copy Markdown

Adds InputDrivenLinearRegressionHMM and InputDrivenCategoricalRegressionHMM where the initial-state and transition distributions are multinomial logistic regressions on an input u_t, on top of the existing LinearRegressionHMMEmissions/CategoricalRegressionHMMEmissions.

Currently dynamax only supports input-dependence at the emission level (e.g. LinearRegressionHMM, LogisticRegressionHMM). This PR extends it to the initial state and transitions and the two HMM classes added here can serve as examples of how to combine input-driven state transitions with other emission types.

This wasn't on the help-wanted list, but there's been some interest in this (e.g., #344).

Also includes a fix for _compute_initial_probs receiving inconsistent inputs shapes in _inference_args() vs. the m-step (see that commit for details).

_compute_initial_probs is called from two places: _inference_args()
and _single_expected_log_like() in m_step. But _inference_args()
passes the full input sequence to it, while _single_expected_log_like()
passes only the first timestep's input (as retrieved from
collect_suff_stats).

StandardHMMInitialState never surfaces this, since its distribution()
ignores inputs entirely.

Fix by slicing inputs to the first timestep specifically for the
initial component, leaving the transition/emission components'
full-sequence inputs unchanged.
@umeshksingla umeshksingla changed the title Add input-driven HMM classes where state transitions conditioned on inputs Add input-driven HMM classes where state transitions are conditioned on inputs Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant